home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
cpp_libs
/
answrbok
/
7_9.lha
/
7_9
/
tst.c
< prev
next >
Wrap
Text File
|
1993-08-08
|
1KB
|
62 lines
* Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */
* The C++ Answer Book */
* Tony Hansen */
* All rights reserved. */
include <stream.h>
include "7_9.h"
include "nlink.h"
include "7_9_dlist.h"
ain()
dlist xdlist;
*
nlink i1("ins 1");
xdlist.insert(&i1);
nlink a1("app 1");
xdlist.append(&a1);
nlink i2("ins 2");
xdlist.insert(&i2);
nlink a2("app 2");
xdlist.append(&a2);
/
nlink hello("hello");
xdlist.insert(&hello);
nlink there("there");
xdlist.insert(&there);
nlink how("how");
xdlist.insert(&how);
nlink are("are");
xdlist.insert(&are);
nlink you("you");
xdlist.append(&you);
nlink today("today");
xdlist.insert(&today);
nlink *x;
cout << "forwards\n";
while (xdlist.next(x))
cout << "'" << (char*)x->x << "'\n";
cout << "\nbackwards\n";
while (xdlist.prev(x))
cout << "'" << (char*)x->x << "'\n";
xdlist.next(x);
xdlist.next(x);
nlink Beep("Beep");
xdlist.inserthere(&Beep);
nlink Boop("Boop");
xdlist.appendhere(&Boop);
xdlist.reset();
cout << "\nforwards, removing\n";
while (xdlist.getnext(x))
cout << "'" << (char*)x->x << "'\n";
cout << "\nbackwards\n";
while (xdlist.getprev(x))
cout << "'" << (char*)x->x << "'\n";
return 0;